<template>
    <div>
        <Add @show="show"></Add>
        <Update
            :student="student"
            :updateVisible="updateVisible"
            @show="show"
            @setUpdateVisible="setUpdateVisible"
        ></Update>
        <Search></Search>
        <List
            :students="students"
            :pagination="pagination"
            @show="show"
            @setStudent="setStudent"
            @setUpdateVisible="setUpdateVisible"
        ></List>
    </div>
</template>

<script>
import Add from "../components/student/elementui/Add";
import Update from "../components/student/elementui/Update";
import Search from "../components/student/Search";
import List from "../components/student/elementui/List";
import { getAll } from "../services/student";
export default {
    data() {
        return {
            students: [],
            student: {},
            pagination: {},
            updateVisible: false,
        };
    },
    created() {
        this.show();
    },
    methods: {
        async show(params) {
            let { data } = await getAll(params);
            this.students = data.rows;
            this.pagination = data;
            console.log(data);
        },
        setUpdateVisible(visible) {
            this.updateVisible = visible;
        },
        setStudent(student) {
            this.student = student;
        },
    },
    components: {
        Add,
        Update,
        Search,
        List,
    },
};
</script>

<style>
</style>